#include <iostream>
#include <string>
#include <regex>

int main()
{
    std::string str = "GET /yuanshuai/login?user=ys&pass=123456 HTTP/1.1\r\n";
    std::regex e("(GET|HEAD|POST|PUT|DELETE) ([^?]*)(?:\\?(.*))? (HTTP/1\\.[01])(?:\n|\r\n)?");
    
    std::smatch matches;

    bool ret = std::regex_match(str, matches, e);
    if(ret == false) return -1;

    for(auto &e : matches)
    {   
        std::cout << e << std::endl;
    }

    return 0;
}